      SUBROUTINE GNDIPT(DEPEND)
C
      IMPLICIT REAL*8 (A-H,O-Z)
C
      REAL*8 J2,J3,J4,J22
C
C
C     SUBROUTINE GNDIPT SETS UP THE DIRECTION COSINE MATRIX
C     BETWEEN THE BODY REFERENCE FRAME AND THE LOCAL GEOGRAPHICAL
C     INERTIAL FRAME. IT ALSO COMPUTES THE LOCAL VERTICAL ACCELERATION
C     VECTOR FROM THE INPUT ALTITUDE
C
C     IT IS WRITTEN BY K. YONG OF COMPUTER SCIENCES CORP. IN
C     MARCH 1976 TO HANDLE THE FSD GROUND TESTING SIMULATION
C     CAPABILITY
C
C
C     EXISTING FSD COMMON BLOCKS
C
      COMMON/CNBODY/J2,J3,J4,J22,ZJ20,ZMU,WWO,FLAT,AEARTH
C
      COMMON/CONSTS/PI,TWOPI,RADIAN
C
      COMMON/IMAIN1/ IDATE,LSAVE,INOPT,IPLOT,NUMEQS,IPLTPE,IORB,ITAPE
C
      COMMON/IPOOL1/IGRAV,IDAMP,IDUMY(37)
C
      COMMON/LIBDPR/ZK1D,ZK2D,PHIS,PHILD,DPHILD,BELTD,
     *        GAMLD,ZMDO,ZMBDO,CNV,DECAY
C
      COMMON/RPOOL1/RHOK(10),TIME,SA(3,3),FM1(3,3),ZLK(10),
     *      OMEG(3),ZLKP(10),ZLKDP(10),CMAT(3,3),GBAR(3,3),
     *      YBCM(3),ZBZK(3,10),FCM(3,3),DTO,PHID,PHI
C
      COMMON/RPOOL6/FM(3,3),CIY(3,3),CIZ(3,3),SAT(3,3),SZ1,SZ2,SZ3
C
C     NEW COMMON BLOCKS
C
      COMMON/GRNTST/ALFAEG,DELTAG,PHASEG,ALTUDE,OMGY(3),
     *              GACC(3),GLOCAT(3),IGRUND,IALTUD,IGASBR
C
      COMMON/GMATRX/GMAX(3,3),GMAXT(3,3)
C
      DIMENSION DEPEND(150),OMRB(3)
C
C
C     SET THE FLAGS TO ZERO FOR GROUND TESTING SIMULATION
C
      INOPT=0
      IGRAV=0
      DO 40 I=1,3
      DO 40 J=1,3
      GMAX(I,J)=0.0D0
 40   GMAXT(I,J)=0.0D0
C
C     COMPUTE THE ACCELERATION OF GRAVITY ALONG LOCAL VERTICAL
      IF(IALTUD.EQ.0) GO TO 5
      GACC(3)=(ZMU/(AEARTH+ALTUDE)**2)*3280.8D0
 5    CONTINUE
C
      DE=DELTAG*RADIAN
      AL=ALFAEG*RADIAN
C
      SDE=DSIN(DE)
      CDE=DCOS(DE)
      SAL=DSIN(AL)
      CAL=DCOS(AL)
C
C
C     CONSTRUCT THE DIRECTION COSINE MATRIX
C
      GMAX(1,1) =CAL
      GMAX(1,2) =SAL*CDE
      GMAX(1,3) =SAL*SDE
C
      GMAX(2,1) =-SAL
      GMAX(2,2) =CAL*CDE
      GMAX(2,3) =CAL*SDE
C
      GMAX(3,1) = 0.0D0
      GMAX(3,2) =-SDE
      GMAX(3,3) =CDE
C
C
      DO 10 I=1,3
      OMEG(I)=OMGY(I)*RADIAN
      OMRB(I)=OMEG(I)
      DO 10 J=1,3
      SA(I,J)= GMAX(I,J)
      GMAXT(I,J)=GMAX(J,I)
      SAT(I,J)= SA(J,I)
 10   CONTINUE
C
      L=0
      DO 20 I=1,2
      DO 20 J=1,3
      L=L+1
 20   DEPEND(L)=SA(I,J)
      DO 30 I=1,3
      L=I+6
 30   DEPEND(L)=OMRB(I)
C
      CALL ECHOGD
      IF(IDAMP.EQ.0) RETURN
      PHI=PHILD*RADIAN
      PHID=DPHILD*RADIAN
      DEPEND(10)=PHI
      DEPEND(11)=PHID
      RETURN
      END
